/* Copyright (C) 2022 ulandlink. All rights reserved.
 *
 * File Name:				app_att7022eu_drv.h
 *
 *File Description:	
 *
 * File History:            2022-5-26   first version    zenglj@ulandlink.com
 *
 */
 #ifndef _APP_RN8302B_DRV_H_
 #define _APP_RN8302B_DRV_H_
 
 /************************INCLUDE FILES SECTION*****************/
#include "os_types.h"
#include <serial.h>
#include <os_mutex.h>
#include <os_mq.h>


typedef enum
{
	CURRENT_PHASE_A = 0,
	CURRENT_PHASE_B,
	CURRENT_PHASE_C,
	CURRENT_PHASE_TOTAL,
	
	VOLTAGE_PHASE_A,
	VOLTAGE_PHASE_B,
	VOLTAGE_PHASE_C,
	
	VOLTAGE_LINE_AB,
	VOLTAGE_LINE_BC,
	VOLTAGE_LINE_CA,
	
	POWER_PHASE_A,
	POWER_PHASE_B,
	POWER_PHASE_C,
	POWER_TOTAL,
	
	ENERGY_PHASE_A,
	ENERGY_PHASE_B,
	ENERGY_PHASE_C,
	ENERGY_TOTAL,
	
	FREQ,
}meter_para_e;

typedef enum
{
	SINGLE_PHASE = 0,					//��ʼ��״̬
	THREE_PHASE,
	ERROR_PHASE,
}phase_type_e;

typedef struct 
{		
	uint16 para_HFconst;
	uint16 para_GSUA;//ͨ������
	uint16 para_GSUB;
	uint16 para_GSUC;
	uint16 para_GSIA;
	uint16 para_GSIB;
	uint16 para_GSIC;
	uint16 para_GSIN;

	uint16 para_PA_PHSL;
	uint16 para_PB_PHSL;
	uint16 para_PC_PHSL;
	uint16 para_QA_PHSL;
	uint16 para_QB_PHSL;
	uint16 para_QC_PHSL;

}struct_rn8302_init_para;
 

int rn8302b_value_read(meter_para_e type, uint32_t *num);
rt_err_t app_meter_init(void);
rt_err_t app_meter_fault_get(void * state);
phase_type_e get_phase_type(void);
uint8_t meter_get_ctclamp_current(uint32_t* value);

 #endif